package modelo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;

/**
 * The persistent class for the pista database table.
 * 
 */
@Entity
@NamedQueries({
		@NamedQuery(name = "Pista.buscaPistasPorDeporte", query = "select p from Pista p "
				+ "where p.deporte.idDeporte = :id"),
		@NamedQuery(name = "Pista.seleccionarTodasPistas", query = "select p from Pista p ") })
@Table(name = "pista")
public class Pista implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "id_pista", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idPista;

	@Column(name = "src_imagen", nullable = false, length = 100)
	private String srcImagen;

	// bi-directional many-to-one association to Deporte
	@ManyToOne
	@JoinColumn(name = "id_deporte", nullable = false)
	private Deporte deporte;

	// bi-directional many-to-one association to Reserva
	@OneToMany(mappedBy = "pista")
	private List<Reserva> reservas;

	public Pista() {
	}

	public Pista(String srcImagen) {
		super();
		// this.idPista = idPista;
		this.srcImagen = srcImagen;
	}

	public int getIdPista() {
		return this.idPista;
	}

	public void setIdPista(int idPista) {
		this.idPista = idPista;
	}

	public String getSrcImagen() {
		return this.srcImagen;
	}

	public void setSrcImagen(String srcImagen) {
		this.srcImagen = srcImagen;
	}

	public Deporte getDeporte() {
		return this.deporte;
	}

	public void setDeporte(Deporte deporte) {
		this.deporte = deporte;
	}

	public List<Reserva> getReservas() {
		return this.reservas;
	}

	public void setReservas(List<Reserva> reservas) {
		this.reservas = reservas;
	}

}